package com.nxy.test.logback;

import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;

/**
 * Created by snailnan on 2017/11/27.
 */
public class SampleFilter extends Filter{
    @Override
    public FilterReply decide(Object eventObject) {
        LoggingEvent event = (LoggingEvent)eventObject;
        if (event.getMessage().contains("sample")) {
            return FilterReply.ACCEPT;
        } else {
            return FilterReply.NEUTRAL;
        }
    }
}
